# -*- coding: UTF-8 -*-
"""
    @Author:YTQ
    @Time: 2023/3/5 23:11
    Description:
    
"""
import asyncio
import BarrageClient


async def printer(q):
    while True:
        m = await q.get()
        if m['msg_type'] == 'danmaku':
            print(f'{m["name"]}：{m["content"]}')


async def main(url):
    q = asyncio.Queue()
    dmc = BarrageClient.BarrageClient(url, q)
    asyncio.create_task(printer(q))
    await dmc.start()


# 虎牙直播：https://www.huya.com/688
asyncio.run(main("https://www.huya.com/339124"))
